﻿#ifndef PRODUCTNETWORKACCESSMANAGER_H
#define PRODUCTNETWORKACCESSMANAGER_H

#include "basenetworkaccessmanager.h"
#include "product.h"
#include "formulabase.h"
#include "historyproduct.h"

class ProductNetworkAccessManager : public BaseNetworkAccessManager
{
    Q_OBJECT
public:
    explicit ProductNetworkAccessManager(QObject *parent = nullptr);

    void addProduct(
            QString companyId,
            QString type,
            QString name,
            QString unit,
            QString productNum,
            QString upperLimit,
            QString lowerLimit,
            QString brand,
            QString originPlace,
            QString specifications,
            QString barCode,
            QString remark,
            QString guidePrice1,
            QString guidePrice2,
            QString primaryDirectory,
            QString secondaryDirectory);

    void updateProduct(
            QString companyId,
            QString productId,
            QString type,
            QString name,
            QString unit,
            QString productNum,
            QString upperLimit,
            QString lowerLimit,
            QString brand,
            QString originPlace,
            QString specifications,
            QString barCode,
            QString remark,
            QString guidePrice1,
            QString guidePrice2,
            QString primaryDirectory,
            QString secondaryDirectory);

    void refreshProducts(QString companyId, QString productIds);

    void getProductsByCompanyId(QString companyId);

    void uploadProduct(
            QString companyId,
            QList<Product*> products);

    void uploadProductFinished(
            QString username,
            double totalMoney);

    void addFormula(QString companyId, FormulaBase &formulaBase);

    void deleteFormula(QString companyId, QString combineId);

    void getFormulasByCompanyId(QString companyId);

    void combineProduct(QString companyId, QString combineId, int combineCount);

    void splitProduct(QString username, QString companyId, QString combineId, int splitCount, QString splitInPrices);

    void countProducts(QString username, QString companyId, QList<Product*> products);

    void sanbaoMove(QString companyId, QList<Product*> products, Product::SanBaoMoveType moveType, QString moveCount);

    void updateHistoryProducts(QList<HistoryProduct*> historyProducts, int type);

    void getAllHistoryProdycts(
            QString sourceCompanyId,
            QString targetCompanyId,
            QString productIds,
            int type);

    void deleteProduct(QString companyId, QString productId);
    /**
     * @brief getFormulaInfo 通过企业Id和总成商品Id获取公式信息
     * @param companyId
     * @param combineId
     */
    void getFormulaInfo(QString companyId, QString combineId);
signals:

public slots:
};

#endif // PRODUCTNETWORKACCESSMANAGER_H
